home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C Templates / ModalDialog.c < prev    next >
Text File  |  1994-04-14  |  7KB  |  243 lines

  1. $$Loop ModalDialogs
  2. $$Message User Modal Dialog, u:$Worksheet.name$.h
  3.  
  4. $$File u:$Worksheet.name$.h
  5. /*  $Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  $Worksheet.name$.h
  9.     Function:  Handle this modal dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. /* ======================================================= */
  18. /* ======================================================= */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. /* Init the modal dialog */
  25. void D_Init_$Worksheet.name$(void);
  26.  
  27. /* Hook into the modal dialog filter routine */
  28. Boolean D_Filter_$Worksheet.name$(DialogPtr theDialog, EventRecord *theEvent, short *itemHit);
  29.  
  30. /* Refresh the modal dialog */
  31. void D_Refresh_$Worksheet.name$(DialogPtr theDialog);
  32.  
  33. /* Setup the modal dialog */
  34. void D_Setup_$Worksheet.name$(DialogPtr theDialog);
  35.  
  36. /* Hit in the modal dialog */
  37. void D_Hit_$Worksheet.name$(DialogPtr theDialog, short *itemHit, Boolean *ExitDialog);
  38.  
  39. /* Exit the modal dialog */
  40. void D_Exit_$Worksheet.name$(DialogPtr theDialog);
  41.  
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45.  
  46. /* ======================================================= */
  47. /* ======================================================= */
  48. $$CloseFile
  49. $$Message User Modal Dialog, u:$Worksheet.name$.c
  50.  
  51. $$File u:$Worksheet.name$.c
  52. /*  $Worksheet.name$                                 Handle this dialog */
  53. /*  $CopyRight$ */
  54.  
  55. /*    File name:  $Worksheet.name$.c
  56.     Function:  Handle this modal dialog.
  57.  
  58.     This dialog is called when:
  59.  
  60.     History: $Date$ Original by $Author$
  61.  
  62. */
  63.  
  64. #include "mmCommon$Prototype.name$.h"    /* Common */
  65. #include "Common$Prototype.name$.h"        /* Common */
  66.  
  67. #include "$Worksheet.name$.h"            /* Users specific file */
  68.  
  69. /* ======================================================= */
  70. /* ======================================================= */
  71.  
  72. /* Routine: D_Init_$Worksheet.name$ */
  73. /* Purpose: This routine is called while when the program is first run */
  74. /* This is used for onetime initialization */
  75.  
  76. void D_Init_$Worksheet.name$(void)
  77. {
  78. }
  79.  
  80. /* ======================================================= */
  81.  
  82. /* Routine: D_Filter_$Worksheet.name$ */
  83. /* Purpose: This routine is called while inside of the Modal Dialog filter */
  84.  
  85. Boolean D_Filter_$Worksheet.name$(DialogPtr theDialog,EventRecord *theEvent,short *itemHit)
  86. {
  87. Boolean    Filter_$Worksheet.name$;
  88.  
  89. Filter_$Worksheet.name$ = false;                        /* Let the modal routine handle it */
  90. return(Filter_$Worksheet.name$);
  91. }
  92.  
  93. /* ======================================================= */
  94.  
  95. /* Routine: D_Refresh_$Worksheet.name$ */
  96. /* Purpose: Refresh the modal dialog */
  97.  
  98. void D_Refresh_$Worksheet.name$(DialogPtr theDialog)
  99. {
  100. }
  101.  
  102. /* ======================================================= */
  103.  
  104. /* Routine: D_Setup_$Worksheet.name$ */
  105. /* Purpose: Setup the modal dialog */
  106.  
  107. void D_Setup_$Worksheet.name$(DialogPtr theDialog)
  108. {
  109. }
  110.  
  111. /* ======================================================= */
  112.  
  113. /* Routine: D_Hit_$Worksheet.name$ */
  114. /* Purpose: Hit in the modal dialog */
  115.  
  116. void D_Hit_$Worksheet.name$(DialogPtr theDialog,short *itemHit,Boolean *ExitDialog)
  117. {
  118. short            DType;                            /* Type of dialog item */
  119. Handle            DItem;                            /* Handle to the dialog item */
  120. ControlHandle    CItem;                            /* Control handle */
  121. short            theSelection;                    /* tool selection */
  122.  
  123.  
  124.     $$Loop Control.type = Button
  125.     $$if Control.Default
  126. /* This is the default selection, when RETURN is pressed. */
  127.     $$endif
  128. if (*itemHit == ResD_$Control.name$)            /* Handle the Button, $Control.FullName$, being pressed */
  129.     {
  130.     }
  131.  
  132.     $$EndLoop Control.type
  133.     $$Loop Control.type = Checkbox
  134. if (*itemHit == ResD_$Control.name$)            /* Handle the checkbox, $Control.FullName$, being pressed */
  135.     {
  136.     }
  137.  
  138.     $$EndLoop
  139.     $$Loop Control.type = Radio
  140. if (*itemHit == ResD_$Control.name$)            /* Handle the radio, $Control.FullName$, being pressed */
  141.     {
  142.     }
  143.  
  144.     $$EndLoop
  145.     $$Loop Control.type = Icon
  146.     $$if Control.NonGraphic
  147. if (*itemHit == ResD_$Control.name$)            /* Handle the Icon, $Control.FullName$, being pressed */
  148.     {
  149.     }
  150.  
  151.     $$endif Control.NonGraphic
  152.     $$EndLoop
  153.     $$Loop Control.type = Picture
  154.     $$if Control.NonGraphic
  155. if (*itemHit == ResD_$Control.name$)            /* Handle the Picture, $Control.FullName$, being pressed */
  156.     {
  157.     }
  158.  
  159.     $$endif Control.NonGraphic
  160.     $$EndLoop
  161.     $$Loop Control.type = UButton
  162. if (*itemHit == ResD_$Control.name$)            /* Handle the user plugin button, $Control.FullName$, being pressed */
  163.     {
  164.     }
  165.  
  166.     $$EndLoop
  167.     $$Loop Control.type = UToggle
  168. if (*itemHit == ResD_$Control.name$)            /* Handle the user plugin toggle, $Control.FullName$, being pressed */
  169.     {
  170.     }
  171.  
  172.     $$EndLoop
  173.     $$Loop Control.type = HotRect
  174.     $$if Control.HotSpot
  175. if (*itemHit == ResD_$Control.name$)            /* Handle the HotSpot, $Control.FullName$, being pressed */
  176.     {
  177.     }
  178.  
  179.     $$endif Control.HotSpot
  180.     $$EndLoop
  181.     $$Loop Control.type = Sicn
  182.     $$if Control.NonGraphic
  183. if (*itemHit == ResD_$Control.name$)            /* Handle the Sicn, $Control.FullName$, being pressed */
  184.     {
  185.     }
  186.  
  187.     $$endif Control.NonGraphic
  188.     $$EndLoop
  189.     $$Loop Control.type = Popup
  190. if (*itemHit == ResD_$Control.name$)            /* Handle the Popup, $Control.FullName$, being pressed */
  191.     {
  192.     GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get item information */
  193.     CItem = (ControlHandle)DItem;
  194.     theSelection = GetCtlValue (CItem);            /* Get the Popup selection */
  195.     switch (theSelection)                        /* Select correct item */
  196.         {
  197.         $$Loop PopupItems
  198.         case $Control.PopupID$:                    /* for $Control.PopupName$ */
  199.             break;
  200.         $$EndLoop
  201.  
  202.         default:                                /* allow other buttons, trap for debug */
  203.             break;                                /* end of otherwise */
  204.         }                                        /* end of switch */
  205.     }
  206.  
  207.     $$EndLoop
  208.     $$Loop Control.type = Palette
  209. if (*itemHit == ResD_$Control.name$)            /* Handle the Palette, $Control.FullName$, being pressed */
  210.     {
  211.     GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get item information */
  212.     CItem = (ControlHandle)DItem;
  213.     theSelection = GetCtlValue (CItem);            /* Get the Palette selection */
  214.     switch (theSelection)                        /* Select correct item */
  215.         {
  216.         $$Loop PaletteItems
  217.         case $Control.PaletteID$:                /*  Row $Control.Row$, Column $Control.Column$ */
  218.             break;
  219.         $$EndLoop
  220.  
  221.         default:                                /* allow other buttons, trap for debug */
  222.             break;                                /* end of otherwise */
  223.         }                                        /* end of switch */
  224.     }
  225.  
  226.     $$EndLoop
  227. }
  228.  
  229. /* ======================================================= */
  230.  
  231. /* Routine: D_Exit_$Worksheet.name$ */
  232. /* Purpose: Exit the modal dialog */
  233.  
  234. void D_Exit_$Worksheet.name$(DialogPtr theDialog)
  235. {
  236.  
  237. }
  238.  
  239. /* ======================================================= */
  240. /* ======================================================= */
  241. $$CloseFile
  242. $$EndLoop
  243.